/*
 * Copyright (C) 2008-2011 CBDP Consortium
 * 
 * All rights reserved.
 *
 * This software is licensed as described in the file COPYING, which
 * you should have received as part of this distribution.
 * 
 * This software consists of contributions made by many individuals, 
 * listed below:
 *
 * Author: 	Xabier Laiseca <xabier.laiseca@deusto.es>
 * 			David Ausín <david.ausin@deusto.es>
 */
package cbdp.server.contextreasoner.impl.contextmanager.online.model.wrappers;

import cbdp.server.contextreasoner.model.Instance;
import cbdp.server.contextreasoner.model.ObjectDatatypeProperty;
import cbdp.server.contextreasoner.model.exceptions.NotExistingInstanceException;

public class EagerSavingObjectDatatypePropertyRuleLaunchingWrapper extends EagerSavingGenericPropertyRuleLaunchingWrapper<ObjectDatatypeProperty> implements ObjectDatatypeProperty
{
	@Override
	public String getId()
	{
		return wrapped.getId();
	}

	@Override
	public Instance getObject()
	{
		final Instance instance = wrapped.getObject();
		
		final EagerSavingInstanceRuleLaunchingWrapper wrapper = new EagerSavingInstanceRuleLaunchingWrapper();
		wrapper.setInstance(instance);
		wrapper.setInternalContextManager(contextManager);
		
		return wrapper;
	}

	@Override
	public void setObject(String objectName) throws NotExistingInstanceException
	{
		wrapped.setObject(objectName);
		launchRulesIfNotInExecution();
	}

}
